<?php
$login_lbl = BUtils::T('login_lbl');
$password_lbl = BUtils::T('password_lbl');
$login_facebook_lbl = BUtils::T('login_facebook_lbl');

$this->pageTitle = $login_lbl;
?>
<div class="white-card extra-padding" style="margin:0;width:420px;color:#333;">
		<h3>Start discovering offers</h3>
		<p>Once you start follow merchants you like, Yamii can deliver great offers for your personalized recommendations.</p>
		<hr />
		<p>Join now! <a href="<?php echo Yii::app()->createUrl('/accounts/signup'); ?>">Sign up</a> or</p>
		<p><a href="javascript:;" class="facebookButton btn-facebook"><?php echo $login_facebook_lbl; ?></a></p>
		<hr />
		<div class="login-form row-fluid">
			Already on Yamii? <a href="<?php echo Yii::app()->createUrl('/accounts/login'); ?>">Log in</a>
		</div>
</div>
<script type="text/javascript">
$(function() {
	$('.btn-facebook').click(function(){
		fbUI.login('<?php echo Yii::app()->createUrl('/accounts/facebook'); ?>');
	});
});
function beforeSubmit(e) {
	$(e).attr('disabled', true);
}
function errorSubmit(e) {
	alert('System error. Please contact us with business@yamii.fi.');
	$(e).attr('disabled', false);
}
function afterSubmit(data, e) {
	$(e).removeAttr('disabled');
	if (data.success) {
		alert(data.success);
		location.reload();
	} else {
		for (var ele in data) {
			$('#'+ele).focus();
			return;
		}
	}
}
</script>